home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_emacs.idb / usr / freeware / info / emacs-8.z / emacs-8
Encoding:
GNU Info File  |  1998-10-28  |  47.5 KB  |  1,128 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.63 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Multi-User Branching,  Prev: Creating Branches,  Up: Branches
  6.  
  7. Multi-User Branching
  8. ....................
  9.  
  10.    It is sometimes useful for multiple developers to work simultaneously
  11. on different branches of a file.  This is possible if you create
  12. multiple source directories.  Each source directory should have a link
  13. named `RCS' which points to a common directory of RCS master files.
  14. Then each source directory can have its own choice of versions checked
  15. out, but all share the same common RCS records.
  16.  
  17.    This technique works reliably and automatically, provided that the
  18. source files contain RCS version headers (*note Version Headers::.).
  19. The headers enable Emacs to be sure, at all times, which version number
  20. is present in the work file.
  21.  
  22.    If the files do not have version headers, you must instead tell Emacs
  23. explicitly in each session which branch you are working on.  To do this,
  24. first find the file, then type `C-u C-x C-q' and specify the correct
  25. branch number.  This ensures that Emacs knows which branch it is using
  26. during this particular editing session.
  27.  
  28. 
  29. File: emacs,  Node: Status in VC,  Next: Renaming and VC,  Prev: Branches,  Up: Version Control
  30.  
  31. VC Status Commands
  32. ------------------
  33.  
  34.    To view the detailed version control status and history of a file,
  35. type `C-x v l' (`vc-print-log').  It displays the history of changes to
  36. the current file, including the text of the log entries.  The output
  37. appears in a separate window.
  38.  
  39.    When you are working on a large program, it's often useful to find
  40. all the files that are currently locked, or all the files maintained in
  41. version control at all.  You can use `C-x v d' (`vc-directory') to show
  42. all the locked files in or beneath a certain directory.  This includes
  43. all files that are locked by any user.  `C-u C-x v d' lists all files
  44. in or beneath the specified directory that are maintained with version
  45. control.
  46.  
  47.    The list of files is displayed as a buffer that uses an augmented
  48. Dired mode.  The names of the users locking various files are shown (in
  49. parentheses) in place of the owner and group.  (With CVS, a more
  50. detailed status is shown for each file.)  All the normal Dired commands
  51. work in this buffer.  Most interactive VC commands work also, and apply
  52. to the file name on the current line.
  53.  
  54.    The `C-x v v' command (`vc-next-action'), when used in the augmented
  55. Dired buffer, operates on all the marked files (or the file on the
  56. current line).  If it operates on more than one file, it handles each
  57. file according to its current state; thus, it may check out one file
  58. and check in another (because it is already checked out).  If it has to
  59. check in any files, it reads a single log entry, then uses that text
  60. for all the files being checked in.  This can be convenient for
  61. registering or checking in several files at once, as part of the same
  62. change.
  63.  
  64. 
  65. File: emacs,  Node: Renaming and VC,  Next: Snapshots,  Prev: Status in VC,  Up: Version Control
  66.  
  67. Renaming VC Work Files and Master Files
  68. ---------------------------------------
  69.  
  70.    When you rename a registered file, you must also rename its master
  71. file correspondingly to get proper results.  Use `vc-rename-file' to
  72. rename the source file as you specify, and rename its master file
  73. accordingly.  It also updates any snapshots (*note Snapshots::.) that
  74. mention the file, so that they use the new name; despite this, the
  75. snapshot thus modified may not completely work (*note Snapshot
  76. Caveats::.).
  77.  
  78.    You cannot use `vc-rename-file' on a file that is locked by someone
  79. else.
  80.  
  81. 
  82. File: emacs,  Node: Snapshots,  Next: Version Headers,  Prev: Renaming and VC,  Up: Version Control
  83.  
  84. Snapshots
  85. ---------
  86.  
  87.    A "snapshot" is a named set of file versions (one for each
  88. registered file) that you can treat as a unit.  One important kind of
  89. snapshot is a "release", a (theoretically) stable version of the system
  90. that is ready for distribution to users.
  91.  
  92. * Menu:
  93.  
  94. * Making Snapshots::        The snapshot facilities.
  95. * Snapshot Caveats::        Things to be careful of when using snapshots.
  96.  
  97. 
  98. File: emacs,  Node: Making Snapshots,  Next: Snapshot Caveats,  Up: Snapshots
  99.  
  100. Making and Using Snapshots
  101. ..........................
  102.  
  103.    There are two basic commands for snapshots; one makes a snapshot
  104. with a given name, the other retrieves a named snapshot.
  105.  
  106. `C-x v s NAME RET'
  107.      Define the last saved versions of every registered file in or
  108.      under the current directory as a snapshot named NAME
  109.      (`vc-create-snapshot').
  110.  
  111. `C-x v r NAME RET'
  112.      Check out all registered files at or below the current directory
  113.      level using whatever versions correspond to the snapshot NAME
  114.      (`vc-retrieve-snapshot').
  115.  
  116.      This command reports an error if any files are locked at or below
  117.      the current directory, without changing anything; this is to avoid
  118.      overwriting work in progress.
  119.  
  120.    A snapshot uses a very small amount of resources--just enough to
  121. record the list of file names and which version belongs to the
  122. snapshot.  Thus, you need not hesitate to create snapshots whenever
  123. they are useful.
  124.  
  125.    You can give a snapshot name as an argument to `C-x v =' or `C-x v
  126. ~' (*note Old Versions::.).  Thus, you can use it to compare a snapshot
  127. against the current files, or two snapshots against each other, or a
  128. snapshot against a named version.
  129.  
  130. 
  131. File: emacs,  Node: Snapshot Caveats,  Prev: Making Snapshots,  Up: Snapshots
  132.  
  133. Snapshot Caveats
  134. ................
  135.  
  136.    VC's snapshot facilities are modeled on RCS's named-configuration
  137. support.  They use RCS's native facilities for this, so under VC
  138. snapshots made using RCS are visible even when you bypass VC.
  139.  
  140.    For SCCS, VC implements snapshots itself.  The files it uses contain
  141. name/file/version-number triples.  These snapshots are visible only
  142. through VC.
  143.  
  144.    A snapshot is a set of checked-in versions.  So make sure that all
  145. the files are checked in and not locked when you make a snapshot.
  146.  
  147.    File renaming and deletion can create some difficulties with
  148. snapshots.  This is not a VC-specific problem, but a general design
  149. issue in version control systems that no one has solved very well yet.
  150.  
  151.    If you rename a registered file, you need to rename its master along
  152. with it (the command `vc-rename-file' does this automatically).  If you
  153. are using SCCS, you must also update the records of the snapshot, to
  154. mention the file by its new name (`vc-rename-file' does this, too).  An
  155. old snapshot that refers to a master file that no longer exists under
  156. the recorded name is invalid; VC can no longer retrieve it.  It would
  157. be beyond the scope of this manual to explain enough about RCS and SCCS
  158. to explain how to update the snapshots by hand.
  159.  
  160.    Using `vc-rename-file' makes the snapshot remain valid for
  161. retrieval, but it does not solve all problems.  For example, some of the
  162. files in the program probably refer to others by name.  At the very
  163. least, the makefile probably mentions the file that you renamed.  If you
  164. retrieve an old snapshot, the renamed file is retrieved under its new
  165. name, which is not the name that the makefile expects.  So the program
  166. won't really work as retrieved.
  167.  
  168. 
  169. File: emacs,  Node: Version Headers,  Next: Customizing VC,  Prev: Snapshots,  Up: Version Control
  170.  
  171. Inserting Version Control Headers
  172. ---------------------------------
  173.  
  174.    Sometimes it is convenient to put version identification strings
  175. directly into working files.  Certain special strings called "version
  176. headers" are replaced in each successive version by the number of that
  177. version.
  178.  
  179.    If you are using RCS, and version headers are present in your working
  180. files, Emacs can use them to determine the current version and the
  181. locking state of the files.  This is more reliable than referring to the
  182. master files, which is done when there are no version headers.  Note
  183. that in a multi-branch environment, version headers are necessary to
  184. make VC behave correctly (*note Multi-User Branching::.).
  185.  
  186.    Searching for version headers is controlled by the variable
  187. `vc-consult-headers'.  If it is non-`nil', Emacs searches for headers
  188. to determine the version number you are editing.  Setting it to `nil'
  189. disables this feature.
  190.  
  191.    You can use the `C-x v h' command (`vc-insert-headers') to insert a
  192. suitable header string.
  193.  
  194. `C-x v h'
  195.      Insert headers in a file for use with your version-control system.
  196.  
  197.    The default header string is `$Id$' for RCS and `%W%' for SCCS.  You
  198. can specify other headers to insert by setting the variable
  199. `vc-header-alist'.  Its value is a list of elements of the form
  200. `(PROGRAM . STRING)' where PROGRAM is `RCS' or `SCCS' and STRING is the
  201. string to use.
  202.  
  203.    Instead of a single string, you can specify a list of strings; then
  204. each string in the list is inserted as a separate header on a line of
  205. its own.
  206.  
  207.    It is often necessary to use "superfluous" backslashes when writing
  208. the strings that you put in this variable.  This is to prevent the
  209. string in the constant from being interpreted as a header itself if the
  210. Emacs Lisp file containing it is maintained with version control.
  211.  
  212.    Each header is inserted surrounded by tabs, inside comment
  213. delimiters, on a new line at the start of the buffer.  Normally the
  214. ordinary comment start and comment end strings of the current mode are
  215. used, but for certain modes, there are special comment delimiters for
  216. this purpose; the variable `vc-comment-alist' specifies them.  Each
  217. element of this list has the form `(MODE STARTER ENDER)'.
  218.  
  219.    The variable `vc-static-header-alist' specifies further strings to
  220. add based on the name of the buffer.  Its value should be a list of
  221. elements of the form `(REGEXP . FORMAT)'.  Whenever REGEXP matches the
  222. buffer name, FORMAT is inserted as part of the header.  A header line
  223. is inserted for each element that matches the buffer name, and for each
  224. string specified by `vc-header-alist'.  The header line is made by
  225. processing the string from `vc-header-alist' with the format taken from
  226. the element.  The default value for `vc-static-header-alist' is as
  227. follows:
  228.  
  229.      (("\\.c$" .
  230.        "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
  231.      #endif /* lint */\n"))
  232.  
  233. It specifies insertion of text of this form:
  234.  
  235.  
  236.      #ifndef lint
  237.      static char vcid[] = "STRING";
  238.      #endif /* lint */
  239.  
  240. Note that the text above starts with a blank line.
  241.  
  242.    If you use more than one version header in a file, put them close
  243. together in the file.  The mechanism in `revert-buffer' that preserves
  244. markers may not handle markers positioned between two version headers.
  245.  
  246. 
  247. File: emacs,  Node: Customizing VC,  Prev: Version Headers,  Up: Version Control
  248.  
  249. Customizing VC
  250. --------------
  251.  
  252.    There are many ways of customizing VC.  The variables that control
  253. its behavior fall into three categories, described in the following
  254. sections.
  255.  
  256. * Menu:
  257.  
  258. * VC Workfile Handling::  Various options concerning working files.
  259. * VC Status Retrieval::   How VC finds the version control status of a file,
  260.                             and how to customize this.
  261. * VC Command Execution::  Which commands VC should run, and how.
  262.  
  263. 
  264. File: emacs,  Node: VC Workfile Handling,  Next: VC Status Retrieval,  Up: Customizing VC
  265.  
  266. VC Workfile Handling
  267. ....................
  268.  
  269.    Emacs normally does not save backup files for source files that are
  270. maintained with version control.  If you want to make backup files even
  271. for files that use version control, set the variable
  272. `vc-make-backup-files' to a non-`nil' value.
  273.  
  274.    Normally the work file exists all the time, whether it is locked or
  275. not.  If you set `vc-keep-workfiles' to `nil', then checking in a new
  276. version with `C-x C-q' deletes the work file; but any attempt to visit
  277. the file with Emacs creates it again.  (With CVS, work files are always
  278. kept.)
  279.  
  280.    Editing a version-controlled file through a symbolic link can be
  281. dangerous.  It bypasses the version control system--you can edit the
  282. file without checking it out, and fail to check your changes in.  Also,
  283. your changes might overwrite those of another user.  To protect against
  284. this, VC checks each symbolic link that you visit, to see if it points
  285. to a file under version control.
  286.  
  287.    The variable `vc-follow-symlinks' controls what to do when a
  288. symbolic link points to a version-controlled file.  If it is `nil', VC
  289. only displays a warning message.  If it is `t', VC automatically
  290. follows the link, and visits the real file instead, telling you about
  291. this in the echo area.  If the value is `ask' (the default), VC asks
  292. you each time whether to follow the link.
  293.  
  294. 
  295. File: emacs,  Node: VC Status Retrieval,  Next: VC Command Execution,  Prev: VC Workfile Handling,  Up: Customizing VC
  296.  
  297. VC Status Retrieval
  298. ...................
  299.  
  300.    When deducing the locked/unlocked state of a file, VC first looks for
  301. an RCS version header string in the file (*note Version Headers::.).  If
  302. there is no header string (or if the backend system is SCCS), VC
  303. normally looks at the file permissions of the work file; this is fast.
  304. But there might be situations when the file permissions cannot be
  305. trusted.  In this case the master file has to be consulted, which is
  306. rather expensive.  Also the master file can only tell you *if* there's
  307. any lock on the file, but not whether your work file really contains
  308. that locked version.
  309.  
  310.    You can tell VC not to use version headers to determine lock status
  311. by setting `vc-consult-headers' to `nil'.  VC then always uses the file
  312. permissions (if it can trust them), or else checks the master file.
  313.  
  314.    You can specify the criterion for whether to trust the file
  315. permissions by setting the variable `vc-mistrust-permissions'.  Its
  316. value may be `t' (always mistrust the file permissions and check the
  317. master file), `nil' (always trust the file permissions), or a function
  318. of one argument which makes the decision.  The argument is the
  319. directory name of the `RCS', `CVS' or `SCCS' subdirectory.  A non-`nil'
  320. value from the function says to mistrust the file permissions.  If you
  321. find that the file permissions of work files are changed erroneously,
  322. set `vc-mistrust-permissions' to `t'.  Then VC always checks the master
  323. file to determine the file's status.
  324.  
  325. 
  326. File: emacs,  Node: VC Command Execution,  Prev: VC Status Retrieval,  Up: Customizing VC
  327.  
  328. VC Command Execution
  329. ....................
  330.  
  331.    If `vc-suppress-confirm' is non-`nil', then `C-x C-q' and `C-x v i'
  332. can save the current buffer without asking, and `C-x v u' also operates
  333. without asking for confirmation.  (This variable does not affect `C-x v
  334. c'; that operation is so drastic that it should always ask for
  335. confirmation.)
  336.  
  337.    VC mode does much of its work by running the shell commands for RCS,
  338. CVS and SCCS.  If `vc-command-messages' is non-`nil', VC displays
  339. messages to indicate which shell commands it runs, and additional
  340. messages when the commands finish.
  341.  
  342.    You can specify additional directories to search for version control
  343. programs by setting the variable `vc-path'.  These directories are
  344. searched before the usual search path.  But the proper files are usually
  345. found automatically.
  346.  
  347. 
  348. File: emacs,  Node: Directories,  Next: Comparing Files,  Prev: Version Control,  Up: Files
  349.  
  350. File Directories
  351. ================
  352.  
  353.    The file system groups files into "directories".  A "directory
  354. listing" is a list of all the files in a directory.  Emacs provides
  355. commands to create and delete directories, and to make directory
  356. listings in brief format (file names only) and verbose format (sizes,
  357. dates, and authors included).  There is also a directory browser called
  358. Dired; see *Note Dired::.
  359.  
  360. `C-x C-d DIR-OR-PATTERN RET'
  361.      Display a brief directory listing (`list-directory').
  362.  
  363. `C-u C-x C-d DIR-OR-PATTERN RET'
  364.      Display a verbose directory listing.
  365.  
  366. `M-x make-directory RET DIRNAME RET'
  367.      Create a new directory named DIRNAME.
  368.  
  369. `M-x delete-directory RET DIRNAME RET'
  370.      Delete the directory named DIRNAME.  It must be empty, or you get
  371.      an error.
  372.  
  373.    The command to display a directory listing is `C-x C-d'
  374. (`list-directory').  It reads using the minibuffer a file name which is
  375. either a directory to be listed or a wildcard-containing pattern for
  376. the files to be listed.  For example,
  377.  
  378.      C-x C-d /u2/emacs/etc RET
  379.  
  380. lists all the files in directory `/u2/emacs/etc'.  Here is an example
  381. of specifying a file name pattern:
  382.  
  383.      C-x C-d /u2/emacs/src/*.c RET
  384.  
  385.    Normally, `C-x C-d' prints a brief directory listing containing just
  386. file names.  A numeric argument (regardless of value) tells it to make
  387. a verbose listing including sizes, dates, and authors (like `ls -l').
  388.  
  389.    The text of a directory listing is obtained by running `ls' in an
  390. inferior process.  Two Emacs variables control the switches passed to
  391. `ls': `list-directory-brief-switches' is a string giving the switches
  392. to use in brief listings (`"-CF"' by default), and
  393. `list-directory-verbose-switches' is a string giving the switches to
  394. use in a verbose listing (`"-l"' by default).
  395.  
  396. 
  397. File: emacs,  Node: Comparing Files,  Next: Misc File Ops,  Prev: Directories,  Up: Files
  398.  
  399. Comparing Files
  400. ===============
  401.  
  402.    The command `M-x diff' compares two files, displaying the
  403. differences in an Emacs buffer named `*Diff*'.  It works by running the
  404. `diff' program, using options taken from the variable `diff-switches',
  405. whose value should be a string.
  406.  
  407.    The buffer `*Diff*' has Compilation mode as its major mode, so you
  408. can use `C-x `' to visit successive changed locations in the two source
  409. files.  You can also move to a particular hunk of changes and type RET
  410. or `C-c C-c', or click `Mouse-2' on it, to move to the corresponding
  411. source location.  You can also use the other special commands of
  412. Compilation mode: SPC and DEL for scrolling, and `M-p' and `M-n' for
  413. cursor motion.  *Note Compilation::.
  414.  
  415.    The command `M-x diff-backup' compares a specified file with its most
  416. recent backup.  If you specify the name of a backup file, `diff-backup'
  417. compares it with the source file that it is a backup of.
  418.  
  419.    The command `M-x compare-windows' compares the text in the current
  420. window with that in the next window.  Comparison starts at point in each
  421. window, and each starting position is pushed on the mark ring in its
  422. respective buffer.  Then point moves forward in each window, a character
  423. at a time, until a mismatch between the two windows is reached.  Then
  424. the command is finished.  For more information about windows in Emacs,
  425. *Note Windows::.
  426.  
  427.    With a numeric argument, `compare-windows' ignores changes in
  428. whitespace.  If the variable `compare-ignore-case' is non-`nil', it
  429. ignores differences in case as well.
  430.  
  431.    See also *Note Emerge::, for convenient facilities for merging two
  432. similar files.
  433.  
  434. 
  435. File: emacs,  Node: Misc File Ops,  Next: Compressed Files,  Prev: Comparing Files,  Up: Files
  436.  
  437. Miscellaneous File Operations
  438. =============================
  439.  
  440.    Emacs has commands for performing many other operations on files.
  441. All operate on one file; they do not accept wild card file names.
  442.  
  443.    `M-x view-file' allows you to scan or read a file by sequential
  444. screenfuls.  It reads a file name argument using the minibuffer.  After
  445. reading the file into an Emacs buffer, `view-file' displays the
  446. beginning.  You can then type SPC to scroll forward one windowful, or
  447. DEL to scroll backward.  Various other commands are provided for moving
  448. around in the file, but none for changing it; type `?' while viewing
  449. for a list of them.  They are mostly the same as normal Emacs cursor
  450. motion commands.  To exit from viewing, type `q'.  The commands for
  451. viewing are defined by a special major mode called View mode.
  452.  
  453.    A related command, `M-x view-buffer', views a buffer already present
  454. in Emacs.  *Note Misc Buffer::.
  455.  
  456.    `M-x insert-file' inserts a copy of the contents of the specified
  457. file into the current buffer at point, leaving point unchanged before
  458. the contents and the mark after them.
  459.  
  460.    `M-x write-region' is the inverse of `M-x insert-file'; it copies
  461. the contents of the region into the specified file.  `M-x
  462. append-to-file' adds the text of the region to the end of the specified
  463. file.  *Note Accumulating Text::.
  464.  
  465.    `M-x delete-file' deletes the specified file, like the `rm' command
  466. in the shell.  If you are deleting many files in one directory, it may
  467. be more convenient to use Dired (*note Dired::.).
  468.  
  469.    `M-x rename-file' reads two file names OLD and NEW using the
  470. minibuffer, then renames file OLD as NEW.  If a file named NEW already
  471. exists, you must confirm with `yes' or renaming is not done; this is
  472. because renaming causes the old meaning of the name NEW to be lost.  If
  473. OLD and NEW are on different file systems, the file OLD is copied and
  474. deleted.
  475.  
  476.    The similar command `M-x add-name-to-file' is used to add an
  477. additional name to an existing file without removing its old name.  The
  478. new name must belong on the same file system that the file is on.
  479.  
  480.    `M-x copy-file' reads the file OLD and writes a new file named NEW
  481. with the same contents.  Confirmation is required if a file named NEW
  482. already exists, because copying has the consequence of overwriting the
  483. old contents of the file NEW.
  484.  
  485.    `M-x make-symbolic-link' reads two file names OLD and LINKNAME, then
  486. creates a symbolic link named LINKNAME and pointing at OLD.  The effect
  487. is that future attempts to open file LINKNAME will refer to whatever
  488. file is named OLD at the time the opening is done, or will get an error
  489. if the name OLD is not in use at that time.  This command does not
  490. expand the argument FILENAME, so that it allows you to specify a
  491. relative name as the target of the link.
  492.  
  493.    Confirmation is required when creating the link if LINKNAME is in
  494. use.  Note that not all systems support symbolic links.
  495.  
  496. 
  497. File: emacs,  Node: Compressed Files,  Prev: Misc File Ops,  Up: Files
  498.  
  499. Accessing Compressed Files
  500. ==========================
  501.  
  502.    Emacs comes with a library that can automatically uncompress
  503. compressed files when you visit them, and automatically recompress them
  504. if you alter them and save them.  To enable this feature, type the
  505. command `M-x auto-compression-mode'.
  506.  
  507.    When automatic compression (which implies automatic uncompression as
  508. well) is enabled, Emacs recognizes compressed files by their file names.
  509. File names ending in `.gz' indicate a file compressed with `gzip'.
  510. Other endings indicate other compression programs.
  511.  
  512.    Automatic uncompression and compression apply to all the operations
  513. in which Emacs uses the contents of a file.  This includes visiting it,
  514. saving it, inserting its contents into a buffer, loading it, and byte
  515. compiling it.
  516.  
  517. 
  518. File: emacs,  Node: Buffers,  Next: Windows,  Prev: Files,  Up: Top
  519.  
  520. Using Multiple Buffers
  521. **********************
  522.  
  523.    The text you are editing in Emacs resides in an object called a
  524. "buffer".  Each time you visit a file, a buffer is created to hold the
  525. file's text.  Each time you invoke Dired, a buffer is created to hold
  526. the directory listing.  If you send a message with `C-x m', a buffer
  527. named `*mail*' is used to hold the text of the message.  When you ask
  528. for a command's documentation, that appears in a buffer called `*Help*'.
  529.  
  530.    At any time, one and only one buffer is "selected".  It is also
  531. called the "current buffer".  Often we say that a command operates on
  532. "the buffer" as if there were only one; but really this means that the
  533. command operates on the selected buffer (most commands do).
  534.  
  535.    When Emacs has multiple windows, each window has a chosen buffer
  536. which is displayed there, but at any time only one of the windows is
  537. selected and its chosen buffer is the selected buffer.  Each window's
  538. mode line displays the name of the buffer that the window is displaying
  539. (*note Windows::.).
  540.  
  541.    Each buffer has a name, which can be of any length, and you can
  542. select any buffer by giving its name.  Most buffers are made by
  543. visiting files, and their names are derived from the files' names.  But
  544. you can also create an empty buffer with any name you want.  A newly
  545. started Emacs has a buffer named `*scratch*' which can be used for
  546. evaluating Lisp expressions in Emacs.  The distinction between upper
  547. and lower case matters in buffer names.
  548.  
  549.    Each buffer records individually what file it is visiting, whether
  550. it is modified, and what major mode and minor modes are in effect in it
  551. (*note Major Modes::.).  Any Emacs variable can be made "local to" a
  552. particular buffer, meaning its value in that buffer can be different
  553. from the value in other buffers.  *Note Locals::.
  554.  
  555. * Menu:
  556.  
  557. * Select Buffer::      Creating a new buffer or reselecting an old one.
  558. * List Buffers::       Getting a list of buffers that exist.
  559. * Misc Buffer::           Renaming; changing read-onliness; copying text.
  560. * Kill Buffer::           Killing buffers you no longer need.
  561. * Several Buffers::    How to go through the list of all buffers
  562.              and operate variously on several of them.
  563. * Indirect Buffers::   An indirect buffer shares the text of another buffer.
  564.  
  565. 
  566. File: emacs,  Node: Select Buffer,  Next: List Buffers,  Up: Buffers
  567.  
  568. Creating and Selecting Buffers
  569. ==============================
  570.  
  571. `C-x b BUFFER RET'
  572.      Select or create a buffer named BUFFER (`switch-to-buffer').
  573.  
  574. `C-x 4 b BUFFER RET'
  575.      Similar, but select BUFFER in another window
  576.      (`switch-to-buffer-other-window').
  577.  
  578. `C-x 5 b BUFFER RET'
  579.      Similar, but select BUFFER in a separate frame
  580.      (`switch-to-buffer-other-frame').
  581.  
  582.    To select the buffer named BUFNAME, type `C-x b BUFNAME RET'.  This
  583. runs the command `switch-to-buffer' with argument BUFNAME.  You can use
  584. completion on an abbreviation for the buffer name you want (*note
  585. Completion::.).  An empty argument to `C-x b' specifies the most
  586. recently selected buffer that is not displayed in any window.
  587.  
  588.    Most buffers are created by visiting files, or by Emacs commands that
  589. want to display some text, but you can also create a buffer explicitly
  590. by typing `C-x b BUFNAME RET'.  This makes a new, empty buffer which is
  591. not visiting any file, and selects it for editing.  Such buffers are
  592. used for making notes to yourself.  If you try to save one, you are
  593. asked for the file name to use.  The new buffer's major mode is
  594. determined by the value of `default-major-mode' (*note Major Modes::.).
  595.  
  596.    Note that `C-x C-f', and any other command for visiting a file, can
  597. also be used to switch to an existing file-visiting buffer.  *Note
  598. Visiting::.
  599.  
  600.    Emacs uses buffer names that start with a space for internal
  601. purposes.  It treats these buffers specially in minor ways--for
  602. example, by default they do not record undo information.  It is best to
  603. avoid using such buffer names yourself.
  604.  
  605. 
  606. File: emacs,  Node: List Buffers,  Next: Misc Buffer,  Prev: Select Buffer,  Up: Buffers
  607.  
  608. Listing Existing Buffers
  609. ========================
  610.  
  611. `C-x C-b'
  612.      List the existing buffers (`list-buffers').
  613.  
  614.    To display a list of all the buffers that exist, type `C-x C-b'.
  615. Each line in the list shows one buffer's name, major mode and visited
  616. file.  The buffers are listed in the order, most recently visited first.
  617.  
  618.    `*' at the beginning of a line indicates the buffer is "modified".
  619. If several buffers are modified, it may be time to save some with `C-x
  620. s' (*note Saving::.).  `%' indicates a read-only buffer.  `.' marks the
  621. selected buffer.  Here is an example of a buffer list:
  622.  
  623.       MR Buffer         Size  Mode           File
  624.       -- ------         ----  ----           ----
  625.      .*  emacs.tex      383402 Texinfo       /u2/emacs/man/emacs.tex
  626.          *Help*         1287  Fundamental
  627.          files.el       23076 Emacs-Lisp     /u2/emacs/lisp/files.el
  628.        % RMAIL          64042 RMAIL          /u/rms/RMAIL
  629.       *% man            747   Dired          /u2/emacs/man/
  630.          net.emacs      343885 Fundamental   /u/rms/net.emacs
  631.          fileio.c       27691 C              /u2/emacs/src/fileio.c
  632.          NEWS           67340 Text           /u2/emacs/etc/NEWS
  633.          *scratch*       0     Lisp Interaction
  634.  
  635. Note that the buffer `*Help*' was made by a help request; it is not
  636. visiting any file.  The buffer `man' was made by Dired on the directory
  637. `/u2/emacs/man/'.
  638.  
  639. 
  640. File: emacs,  Node: Misc Buffer,  Next: Kill Buffer,  Prev: List Buffers,  Up: Buffers
  641.  
  642. Miscellaneous Buffer Operations
  643. ===============================
  644.  
  645. `C-x C-q'
  646.      Toggle read-only status of buffer (`vc-toggle-read-only').
  647.  
  648. `M-x rename-buffer RET NAME RET'
  649.      Change the name of the current buffer.
  650.  
  651. `M-x rename-uniquely'
  652.      Rename the current buffer by adding `<NUMBER>' to the end.
  653.  
  654. `M-x view-buffer RET BUFFER RET'
  655.      Scroll through buffer BUFFER.
  656.  
  657.    A buffer can be "read-only", which means that commands to change its
  658. contents are not allowed.  The mode line indicates read-only buffers
  659. with `%%' or `%*' near the left margin.  Read-only buffers are usually
  660. made by subsystems such as Dired and Rmail that have special commands
  661. to operate on the text; also by visiting a file whose access control
  662. says you cannot write it.
  663.  
  664.    If you wish to make changes in a read-only buffer, use the command
  665. `C-x C-q' (`vc-toggle-read-only').  It makes a read-only buffer
  666. writable, and makes a writable buffer read-only.  In most cases, this
  667. works by setting the variable `buffer-read-only', which has a local
  668. value in each buffer and makes the buffer read-only if its value is
  669. non-`nil'.  If the file is maintained with version control, `C-x C-q'
  670. works through the version control system to change the read-only status
  671. of the file as well as the buffer.  *Note Version Control::.
  672.  
  673.    `M-x rename-buffer' changes the name of the current buffer.  Specify
  674. the new name as a minibuffer argument.  There is no default.  If you
  675. specify a name that is in use for some other buffer, an error happens
  676. and no renaming is done.
  677.  
  678.    `M-x rename-uniquely' renames the current buffer to a similar name
  679. with a numeric suffix added to make it both different and unique.  This
  680. command does not need an argument.  It is useful for creating multiple
  681. shell buffers: if you rename the `*Shell*' buffer, then do `M-x shell'
  682. again, it makes a new shell buffer named `*Shell*'; meanwhile, the old
  683. shell buffer continues to exist under its new name.  This method is
  684. also good for mail buffers, compilation buffers, and most Emacs
  685. features that create special buffers with particular names.
  686.  
  687.    `M-x view-buffer' is much like `M-x view-file' (*note Misc File
  688. Ops::.) except that it examines an already existing Emacs buffer.  View
  689. mode provides commands for scrolling through the buffer conveniently
  690. but not for changing it.  When you exit View mode, the value of point
  691. that resulted from your perusal remains in effect.
  692.  
  693.    The commands `M-x append-to-buffer' and `M-x insert-buffer' can be
  694. used to copy text from one buffer to another.  *Note Accumulating
  695. Text::.
  696.  
  697. 
  698. File: emacs,  Node: Kill Buffer,  Next: Several Buffers,  Prev: Misc Buffer,  Up: Buffers
  699.  
  700. Killing Buffers
  701. ===============
  702.  
  703.    If you continue an Emacs session for a while, you may accumulate a
  704. large number of buffers.  You may then find it convenient to "kill" the
  705. buffers you no longer need.  On most operating systems, killing a
  706. buffer releases its space back to the operating system so that other
  707. programs can use it.  Here are some commands for killing buffers:
  708.  
  709. `C-x k BUFNAME RET'
  710.      Kill buffer BUFNAME (`kill-buffer').
  711.  
  712. `M-x kill-some-buffers'
  713.      Offer to kill each buffer, one by one.
  714.  
  715.    `C-x k' (`kill-buffer') kills one buffer, whose name you specify in
  716. the minibuffer.  The default, used if you type just RET in the
  717. minibuffer, is to kill the current buffer.  If you kill the current
  718. buffer, another buffer is selected; one that has been selected recently
  719. but does not appear in any window now.  If you ask to kill a
  720. file-visiting buffer that is modified (has unsaved editing), then you
  721. must confirm with `yes' before the buffer is killed.
  722.  
  723.    The command `M-x kill-some-buffers' asks about each buffer, one by
  724. one.  An answer of `y' means to kill the buffer.  Killing the current
  725. buffer or a buffer containing unsaved changes selects a new buffer or
  726. asks for confirmation just like `kill-buffer'.
  727.  
  728.    The buffer menu feature (*note Several Buffers::.) is also convenient
  729. for killing various buffers.
  730.  
  731.    If you want to do something special every time a buffer is killed,
  732. you can add hook functions to the hook `kill-buffer-hook' (*note
  733. Hooks::.).
  734.  
  735. 
  736. File: emacs,  Node: Several Buffers,  Next: Indirect Buffers,  Prev: Kill Buffer,  Up: Buffers
  737.  
  738. Operating on Several Buffers
  739. ============================
  740.  
  741.    The "buffer-menu" facility is like a "Dired for buffers"; it allows
  742. you to request operations on various Emacs buffers by editing an Emacs
  743. buffer containing a list of them.  You can save buffers, kill them
  744. (here called "deleting" them, for consistency with Dired), or display
  745. them.
  746.  
  747. `M-x buffer-menu'
  748.      Begin editing a buffer listing all Emacs buffers.
  749.  
  750.    The command `buffer-menu' writes a list of all Emacs buffers into
  751. the buffer `*Buffer List*', and selects that buffer in Buffer Menu
  752. mode.  The buffer is read-only, and can be changed only through the
  753. special commands described in this section.  The usual Emacs cursor
  754. motion commands can be used in the `*Buffer List*' buffer.  The
  755. following commands apply to the buffer described on the current line.
  756.  
  757. `d'
  758.      Request to delete (kill) the buffer, then move down.  The request
  759.      shows as a `D' on the line, before the buffer name.  Requested
  760.      deletions take place when you type the `x' command.
  761.  
  762. `C-d'
  763.      Like `d' but move up afterwards instead of down.
  764.  
  765. `s'
  766.      Request to save the buffer.  The request shows as an `S' on the
  767.      line.  Requested saves take place when you type the `x' command.
  768.      You may request both saving and deletion for the same buffer.
  769.  
  770. `x'
  771.      Perform previously requested deletions and saves.
  772.  
  773. `u'
  774.      Remove any request made for the current line, and move down.
  775.  
  776. `DEL'
  777.      Move to previous line and remove any request made for that line.
  778.  
  779.    The `d', `C-d', `s' and `u' commands to add or remove flags also
  780. move down (or up) one line.  They accept a numeric argument as a repeat
  781. count.
  782.  
  783.    These commands operate immediately on the buffer listed on the
  784. current line:
  785.  
  786. `~'
  787.      Mark the buffer "unmodified".  The command `~' does this
  788.      immediately when you type it.
  789.  
  790. `%'
  791.      Toggle the buffer's read-only flag.  The command `%' does this
  792.      immediately when you type it.
  793.  
  794. `t'
  795.      Visit the buffer as a tags table.  *Note Select Tags Table::.
  796.  
  797.    There are also commands to select another buffer or buffers:
  798.  
  799. `q'
  800.      Quit the buffer menu--immediately display the most recent formerly
  801.      visible buffer in its place.
  802.  
  803. `RET'
  804. `f'
  805.      Immediately select this line's buffer in place of the `*Buffer
  806.      List*' buffer.
  807.  
  808. `o'
  809.      Immediately select this line's buffer in another window as if by
  810.      `C-x 4 b', leaving `*Buffer List*' visible.
  811.  
  812. `C-o'
  813.      Immediately display this line's buffer in another window, but don't
  814.      select the window.
  815.  
  816. `1'
  817.      Immediately select this line's buffer in a full-screen window.
  818.  
  819. `2'
  820.      Immediately set up two windows, with this line's buffer in one,
  821.      and the previously selected buffer (aside from the buffer `*Buffer
  822.      List*') in the other.
  823.  
  824. `m'
  825.      Mark this line's buffer to be displayed in another window if you
  826.      exit with the `v' command.  The request shows as a `>' at the
  827.      beginning of the line.  (A single buffer may not have both a delete
  828.      request and a display request.)
  829.  
  830. `v'
  831.      Immediately select this line's buffer, and also display in other
  832.      windows any buffers previously marked with the `m' command.  If
  833.      you have not marked any buffers, this command is equivalent to `1'.
  834.  
  835.    All that `buffer-menu' does directly is create and switch to a
  836. suitable buffer, and turn on Buffer Menu mode.  Everything else
  837. described above is implemented by the special commands provided in
  838. Buffer Menu mode.  One consequence of this is that you can switch from
  839. the `*Buffer List*' buffer to another Emacs buffer, and edit there.
  840. You can reselect the `*Buffer List*' buffer later, to perform the
  841. operations already requested, or you can kill it, or pay no further
  842. attention to it.
  843.  
  844.    The only difference between `buffer-menu' and `list-buffers' is that
  845. `buffer-menu' switches to the `*Buffer List*' buffer in the selected
  846. window; `list-buffers' displays it in another window.  If you run
  847. `list-buffers' (that is, type `C-x C-b') and select the buffer list
  848. manually, you can use all of the commands described here.
  849.  
  850.    The buffer `*Buffer List*' is not updated automatically when buffers
  851. are created and killed; its contents are just text.  If you have
  852. created, deleted or renamed buffers, the way to update `*Buffer List*'
  853. to show what you have done is to type `g' (`revert-buffer') or repeat
  854. the `buffer-menu' command.
  855.  
  856. 
  857. File: emacs,  Node: Indirect Buffers,  Prev: Several Buffers,  Up: Buffers
  858.  
  859. Indirect Buffers
  860. ================
  861.  
  862.    An "indirect buffer" shares the text of some other buffer, which is
  863. called the "base buffer" of the indirect buffer.  In some ways it is
  864. the analogue, for buffers, of a symbolic link between files.
  865.  
  866. `M-x make-indirect-buffer BASE-BUFFER RET INDIRECT-NAME RET'
  867.      Create an indirect buffer named INDIRECT-NAME whose base buffer is
  868.      BASE-BUFFER.
  869.  
  870.    The text of the indirect buffer is always identical to the text of
  871. its base buffer; changes made by editing either one are visible
  872. immediately in the other.  But in all other respects, the indirect
  873. buffer and its base buffer are completely separate.  They have
  874. different names, different values of point, different narrowing,
  875. different markers, different major modes, and different local variables.
  876.  
  877.    An indirect buffer cannot visit a file, but its base buffer can.  If
  878. you try to save the indirect buffer, that actually works by saving the
  879. base buffer.  Killing the base buffer effectively kills the indirect
  880. buffer, but killing an indirect buffer has no effect on its base buffer.
  881.  
  882.    One way to use indirect buffers is to display multiple views of an
  883. outline.  *Note Outline Views::.
  884.  
  885. 
  886. File: emacs,  Node: Windows,  Next: Frames,  Prev: Buffers,  Up: Top
  887.  
  888. Multiple Windows
  889. ****************
  890.  
  891.    Emacs can split a frame into two or many windows.  Multiple windows
  892. can display parts of different buffers, or different parts of one
  893. buffer.  Multiple frames always imply multiple windows, because each
  894. frame has its own set of windows.  Each window belongs to one and only
  895. one frame.
  896.  
  897. * Menu:
  898.  
  899. * Basic Window::       Introduction to Emacs windows.
  900. * Split Window::       New windows are made by splitting existing windows.
  901. * Other Window::       Moving to another window or doing something to it.
  902. * Pop Up Window::      Finding a file or buffer in another window.
  903. * Force Same Window::  Forcing certain buffers to appear in the selected
  904.                          window rather than in another window.
  905. * Change Window::      Deleting windows and changing their sizes.
  906.  
  907. 
  908. File: emacs,  Node: Basic Window,  Next: Split Window,  Up: Windows
  909.  
  910. Concepts of Emacs Windows
  911. =========================
  912.  
  913.    Each Emacs window displays one Emacs buffer at any time.  A single
  914. buffer may appear in more than one window; if it does, any changes in
  915. its text are displayed in all the windows where it appears.  But the
  916. windows showing the same buffer can show different parts of it, because
  917. each window has its own value of point.
  918.  
  919.    At any time, one of the windows is the "selected window"; the buffer
  920. this window is displaying is the current buffer.  The terminal's cursor
  921. shows the location of point in this window.  Each other window has a
  922. location of point as well, but since the terminal has only one cursor
  923. there is no way to show where those locations are.  When multiple
  924. frames are visible in X Windows, each frame has a cursor which appears
  925. in the frame's selected window.  The cursor in the selected frame is
  926. solid; the cursor in other frames is a hollow box.
  927.  
  928.    Commands to move point affect the value of point for the selected
  929. Emacs window only.  They do not change the value of point in any other
  930. Emacs window, even one showing the same buffer.  The same is true for
  931. commands such as `C-x b' to change the selected buffer in the selected
  932. window; they do not affect other windows at all.  However, there are
  933. other commands such as `C-x 4 b' that select a different window and
  934. switch buffers in it.  Also, all commands that display information in a
  935. window, including (for example) `C-h f' (`describe-function') and `C-x
  936. C-b' (`list-buffers'), work by switching buffers in a nonselected window
  937. without affecting the selected window.
  938.  
  939.    When multiple windows show the same buffer, they can have different
  940. regions, because they can have different values of point.  This means
  941. that in Transient Mark mode, each window highlights a different part of
  942. the buffer.  The part that is highlighted in the selected window is the
  943. region that editing commands use.
  944.  
  945.    Each window has its own mode line, which displays the buffer name,
  946. modification status and major and minor modes of the buffer that is
  947. displayed in the window.  *Note Mode Line::, for full details on the
  948. mode line.
  949.  
  950. 
  951. File: emacs,  Node: Split Window,  Next: Other Window,  Prev: Basic Window,  Up: Windows
  952.  
  953. Splitting Windows
  954. =================
  955.  
  956. `C-x 2'
  957.      Split the selected window into two windows, one above the other
  958.      (`split-window-vertically').
  959.  
  960. `C-x 3'
  961.      Split the selected window into two windows positioned side by side
  962.      (`split-window-horizontally').
  963.  
  964. `C-Mouse-2'
  965.      In the mode line or scroll bar of a window, split that window.
  966.  
  967.    The command `C-x 2' (`split-window-vertically') breaks the selected
  968. window into two windows, one above the other.  Both windows start out
  969. displaying the same buffer, with the same value of point.  By default
  970. the two windows each get half the height of the window that was split; a
  971. numeric argument specifies how many lines to give to the top window.
  972.  
  973.    `C-x 3' (`split-window-horizontally') breaks the selected window
  974. into two side-by-side windows.  A numeric argument specifies how many
  975. columns to give the one on the left.  A line of vertical bars separates
  976. the two windows.  Windows that are not the full width of the screen
  977. have mode lines, but they are truncated; also, they do not always
  978. appear in inverse video, because the Emacs display routines have not
  979. been taught how to display a region of inverse video that is only part
  980. of a line on the screen.
  981.  
  982.    You can split a window horizontally or vertically by clicking
  983. `C-Mouse-2' in the mode line or the scroll bar.  The line of splitting
  984. goes through the place where you click: if you click on the mode line,
  985. the new scroll bar goes above the spot; if you click in the scroll bar,
  986. the mode line of the split window is side by side with your click.
  987.  
  988.    When a window is less than the full width, text lines too long to
  989. fit are frequent.  Continuing all those lines might be confusing.  The
  990. variable `truncate-partial-width-windows' can be set non-`nil' to force
  991. truncation in all windows less than the full width of the screen,
  992. independent of the buffer being displayed and its value for
  993. `truncate-lines'.  *Note Continuation Lines::.
  994.  
  995.    Horizontal scrolling is often used in side-by-side windows.  *Note
  996. Display::.
  997.  
  998.    If `split-window-keep-point' is non-nil, `C-x 2' tries to avoid
  999. shifting any text on the screen by putting point in whichever window
  1000. happens to contain the screen line the cursor is already on.  The
  1001. default is that `split-window-keep-point' is non-nil on slow terminals.
  1002.  
  1003. 
  1004. File: emacs,  Node: Other Window,  Next: Pop Up Window,  Prev: Split Window,  Up: Windows
  1005.  
  1006. Using Other Windows
  1007. ===================
  1008.  
  1009. `C-x o'
  1010.      Select another window (`other-window').  That is `o', not zero.
  1011.  
  1012. `C-M-v'
  1013.      Scroll the next window (`scroll-other-window').
  1014.  
  1015. `M-x compare-windows'
  1016.      Find next place where the text in the selected window does not
  1017.      match the text in the next window.
  1018.  
  1019. `Mouse-1'
  1020.      `Mouse-1', in a window's mode line, selects that window but does
  1021.      not move point in it (`mouse-select-region').
  1022.  
  1023.    To select a different window, click with `Mouse-1' on its mode line.
  1024. With the keyboard, you can switch windows by typing `C-x o'
  1025. (`other-window').  That is an `o', for `other', not a zero.  When there
  1026. are more than two windows, this command moves through all the windows
  1027. in a cyclic order, generally top to bottom and left to right.  After
  1028. the rightmost and bottommost window, it goes back to the one at the
  1029. upper left corner.  A numeric argument means to move several steps in
  1030. the cyclic order of windows.  A negative argument moves around the
  1031. cycle in the opposite order.  When the minibuffer is active, the
  1032. minibuffer is the last window in the cycle; you can switch from the
  1033. minibuffer window to one of the other windows, and later switch back and
  1034. finish supplying the minibuffer argument that is requested.  *Note
  1035. Minibuffer Edit::.
  1036.  
  1037.    The usual scrolling commands (*note Display::.) apply to the selected
  1038. window only, but there is one command to scroll the next window.
  1039. `C-M-v' (`scroll-other-window') scrolls the window that `C-x o' would
  1040. select.  It takes arguments, positive and negative, like `C-v'.  (In
  1041. the minibuffer, `C-M-v' scrolls the window that contains the minibuffer
  1042. help display, if any, rather than the next window in the standard
  1043. cyclic order.)
  1044.  
  1045.    The command `M-x compare-windows' lets you compare two files or
  1046. buffers visible in two windows, by moving through them to the next
  1047. mismatch.  *Note Comparing Files::, for details.
  1048.  
  1049. 
  1050. File: emacs,  Node: Pop Up Window,  Next: Force Same Window,  Prev: Other Window,  Up: Windows
  1051.  
  1052. Displaying in Another Window
  1053. ============================
  1054.  
  1055.    `C-x 4' is a prefix key for commands that select another window
  1056. (splitting the window if there is only one) and select a buffer in that
  1057. window.  Different `C-x 4' commands have different ways of finding the
  1058. buffer to select.
  1059.  
  1060. `C-x 4 b BUFNAME RET'
  1061.      Select buffer BUFNAME in another window.  This runs
  1062.      `switch-to-buffer-other-window'.
  1063.  
  1064. `C-x 4 C-o BUFNAME RET'
  1065.      Display buffer BUFNAME in another window, but don't select that
  1066.      buffer or that window.  This runs `display-buffer'.
  1067.  
  1068. `C-x 4 f FILENAME RET'
  1069.      Visit file FILENAME and select its buffer in another window.  This
  1070.      runs `find-file-other-window'.  *Note Visiting::.
  1071.  
  1072. `C-x 4 d DIRECTORY RET'
  1073.      Select a Dired buffer for directory DIRECTORY in another window.
  1074.      This runs `dired-other-window'.  *Note Dired::.
  1075.  
  1076. `C-x 4 m'
  1077.      Start composing a mail message in another window.  This runs
  1078.      `mail-other-window'; its same-window analogue is `C-x m' (*note
  1079.      Sending Mail::.).
  1080.  
  1081. `C-x 4 .'
  1082.      Find a tag in the current tags table, in another window.  This runs
  1083.      `find-tag-other-window', the multiple-window variant of `M-.'
  1084.      (*note Tags::.).
  1085.  
  1086. `C-x 4 r FILENAME RET'
  1087.      Visit file FILENAME read-only, and select its buffer in another
  1088.      window.  This runs `find-file-read-only-other-window'.  *Note
  1089.      Visiting::.
  1090.  
  1091. 
  1092. File: emacs,  Node: Force Same Window,  Next: Change Window,  Prev: Pop Up Window,  Up: Windows
  1093.  
  1094. Forcing Display in the Same Window
  1095. ==================================
  1096.  
  1097.    Certain Emacs commands switch to a specific buffer with special
  1098. contents.  For example, `M-x shell' switches to a buffer named
  1099. `*Shell*'.  By convention, all these commands are written to pop up the
  1100. buffer in a separate window.  But you can specify that certain of these
  1101. buffers should appear in the selected window.
  1102.  
  1103.    If you add a buffer name to the list `same-window-buffer-names', the
  1104. effect is that such commands display that particular buffer by
  1105. switching to it in the selected window.  For example, if you add the
  1106. element `"*grep*"' to the list, the `grep' command will display its
  1107. output buffer in the selected window.
  1108.  
  1109.    The default value of `same-window-buffer-names' is not `nil'.  It
  1110. specifies the buffers `*info*', `*mail*' and `*shell*'.  This is why
  1111. `M-x shell' normally switches to the `*shell*' buffer in the selected
  1112. window.  If you delete this element from the value of
  1113. `same-window-buffer-names', the behavior of `M-x shell' will change--it
  1114. will pop up the buffer in another window instead.
  1115.  
  1116.    You can specify these buffers more generally with the variable
  1117. `same-window-regexps'.  Set it to a list of regular expressions; then
  1118. any buffer whose name matches one of those regular expressions is
  1119. displayed by switching to it in the selected window.  (Once again, this
  1120. applies only to buffers that normally get displayed for you in a
  1121. separate window.)  The default value of this variable specifies Telnet
  1122. and rlogin buffers.
  1123.  
  1124.    An analogous feature lets you specify buffers which should be
  1125. displayed in their own individual frames.  *Note Special Buffer
  1126. Frames::.
  1127.  
  1128.